package leetcode.number;

public class IsPalindrome {

    public static boolean isPalindrome(int x) {
        if (x < 0) {
            return false;
        } else if (x >= 0 && x < 10) {
            return true;
        } else {
            String s = String.valueOf(x);
            int head = 0;
            int tail = s.length() - 1;

            while (head < tail) {
                if (s.charAt(head) != s.charAt(tail)) {
                    return false;
                }

                head++;
                tail--;
            }

        }
        return true;
    }

}
